home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- #+++
- # RCS archbom,v 1.2 1995/07/30 21:04:01 tom Exp
- # title: archbom
- # abstract: Determine architectures of *.bom file
- # author: T.R.Hageman
- # created: July 1995
- # modified: (see RCS Log at end)
- # copyleft:
- #
- # Copyright (C) 1995 Tom R. Hageman.
- #
- # This is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # This software is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this software; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- # description:
- #
- # This script is part of PackageInspector
- #
- # Determine architectures supported by Installer package's *.bom
- # (this method is slow, but requires no internal knowledge of the .bom
- # format)
- #---
-
- # Extend this when NS supports more archs than the ones in 3.3
- CHECKARCHS='m68k i386 hppa sparc'
-
- # Assume NS never gets ported to this.
- DUMMYARCH=vax
-
- lsbom='/usr/etc/lsbom'
-
- bom="$1"
-
- [ -n "$bom" ] || { echo "Usage: `basename $0` bom"; exit 1; }
- [ -r "$bom" ] || { echo "???"; exit 1; }
-
- # If lsbom not present, assume we're running on a pre-3.1 system.
- # There's nothing much we can do without it ...
- [ -r $lsbom ] || { echo "old"; exit 0; }
-
- all_lines=`$lsbom -s $bom 2>/dev/null | wc -l`
-
- # If no lines, assume *.bom is in pre-fat ASCII format.
- # (in which case the package contains either m68k software or
- # architecture-independent stuff; we have no way of knowing...)
-
- [ $all_lines = 0 ] && { echo "old"; exit 0; }
-
- none_lines=`$lsbom -s -arch $DUMMYARCH $bom 2>/dev/null | wc -l`
-
- [ $all_lines = $none_lines ] && { echo "any"; exit 0; }
-
- sep=
- for a in $CHECKARCHS
- do
- lines=`$lsbom -s -arch $a $bom 2>/dev/null | wc -l`
- if [ $lines -gt $none_lines ]
- then
- if [ $lines -lt $all_lines ]
- then
- echo -n "$sep($a)"
- else
- echo -n "$sep$a"
- fi
- sep=", "
- fi
- done
- echo
-
- exit 0
-
- #=======================================================================
- # archbom,v
- # Revision 1.2 1995/07/30 21:04:01 tom
- # stdheader added; detect partial arch support; indicate this with
- # parenthizing archname; output arch names as soon as detected.
- #
- #=======================================================================
-